<?php
/**
* @author: Nguyen Thanh Tung
* @date: Friday, January 24, 2014
*/


if( !isset($AppUI->id)||
!isset($_SESSION['personal'])||
isset($_SESSION['personal'])&& ($_SESSION['personal']&1<<0)==0)
{
	redirect(HOST_BACKEND);
}

$intTotal      = 0;
$intPage       = (int)$this->input->get('page', 1);
$intCancel	   = (int)$this->input->get('pcancel', 0);
$intLimit      = 20;
$intOffset     = ($intPage-1)*$intLimit;

$intStatus     = (int)$this->input->get('stt','-1');
$strStartDate  = $this->input->get('startdate',null);
$strEndDate    = $this->input->get('enddate',null);
$intPersonalId     = (int)$this->input->get('persionalid',0);//test($intClubId);
$intLeagueId = '';
$intCategoryId = '';
$intSeasonId='';
/*
//kiem tra dateStart va dateEnd
if($strStartDate != '' || $strEndDate != ''||$intStatus!=-1) {	
	$_SESSION['UNIFORM_CANCEL'] 	= 1;	
	$_SESSION['UNIFORM_SEARCH']	= $this->input->get();
}else {	
	if(isset($_SESSION['STADIUM_SEARCH'])) unset($_SESSION['STADIUM_SEARCH']);
	if(isset($_SESSION['UNIFORM_CANCEL'])) unset($_SESSION['UNIFORM_CANCEL']);
    $strStartDate = '';
    $strEndDate = '';
	$intStatus = -1;
}

if($intCancel) {
	if(isset($_SESSION['UNIFORM_CANCEL'])) unset($_SESSION['UNIFORM_CANCEL']);
	if(isset($_SESSION['UNIFORM_CANCEL'])) unset($_SESSION['UNIFORM_CANCEL']);
    $strStartDate = '';
    $strEndDate = '';
	$intStatus = -1;
}*/

$this->load->model('title_model', 'title');
$arrResult	= $this->title->getAll($AppUI->id,$intStatus,$intPersonalId,$intLeagueId,$intCategoryId,$intSeasonId, $strStartDate,$strEndDate,$intOffset,$intLimit, $intTotal);
//test($arrResult);
$this->smarty->assign('arrResult',  $arrResult);
$this->smarty->assign('intTotal',   $intTotal);
$this->smarty->assign('intOffset',  $intOffset);
$this->smarty->assign('intLimit',   $intLimit);
$this->smarty->display('title/index.tpl');